//
//  ViewController.m
//  LOL
//
//  Created by Justsoso on 16/3/3.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tabelView;
@property (nonatomic,strong) NSArray *list;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSString *path = [[NSBundle mainBundle] pathForResource:@"heroes" ofType:@"plist"];
    self.list = [NSArray arrayWithContentsOfFile:path];
    
    // 表格的属性
    self.tabelView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tabelView.rowHeight = 60;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.list.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
    }
    
    cell.textLabel.text = self.list[indexPath.row][@"name"];
    cell.imageView.image = [UIImage imageNamed:self.list[indexPath.row][@"icon"]];
    cell.detailTextLabel.text = self.list[indexPath.row][@"intro"];
    
    return cell;
}

@end
